PartDesign: Make Base Feature compatible with GeoFeatureGroup. fixes #0003080

The Original BaseFeature implementation had some serious issues with scoped links. It failed completely for e.g. sketches on the BaseFeature as it made a local link to refere to a out of body object. The only solution to make this work correctly is to add a proxy object into the body which is alloed to exactly that, to link outside oof the body. Something like shapebinder.
This commit is contained in:
Stefan Tröger
2017-09-16 15:47:07 +02:00
committed by wmayer
parent 30f930404c
commit de31528dda
15 changed files with 820 additions and 47 deletions

View File

@@ -86,18 +86,21 @@ bool BodyBase::isAfter(const App::DocumentObject *feature, const App::DocumentOb
}
void BodyBase::onBeforeChange (const App::Property* prop) {
// If we are changing the base feature and tip point to it reset it
//Tip can't point outside the body, hence no base feature tip
/*// If we are changing the base feature and tip point to it reset it
if ( prop == &BaseFeature && BaseFeature.getValue() == Tip.getValue() && BaseFeature.getValue() ) {
Tip.setValue( nullptr );
}
}*/
Part::Feature::onBeforeChange ( prop );
}
void BodyBase::onChanged (const App::Property* prop) {
// If the tip is zero and we are adding a base feature to the body set it to be the tip
//Tip can't point outside the body, hence no base feature tip
/*// If the tip is zero and we are adding a base feature to the body set it to be the tip
if ( prop == &BaseFeature && !Tip.getValue() && BaseFeature.getValue() ) {
Tip.setValue( BaseFeature.getValue () );
}
}*/
Part::Feature::onChanged ( prop );
}

View File

@@ -58,6 +58,7 @@
#include "FeaturePipe.h"
#include "FeatureLoft.h"
#include "ShapeBinder.h"
#include "FeatureBase.h"
namespace PartDesign {
extern PyObject* initModule();
@@ -146,6 +147,7 @@ PyMOD_INIT_FUNC(_PartDesign)
PartDesign::Wedge ::init();
PartDesign::AdditiveWedge ::init();
PartDesign::SubtractiveWedge ::init();
PartDesign::FeatureBase ::init();
PyMOD_Return(mod);
}

View File

@@ -47,6 +47,7 @@
#include "ShapeBinder.h"
#include "Body.h"
#include "FeatureBase.h"
#include "BodyPy.h"
using namespace PartDesign;
@@ -109,8 +110,7 @@ void Body::onChanged(const App::Property *prop)
short Body::mustExecute() const
{
if ( Tip.isTouched() ||
BaseFeature.isTouched() ) {
if ( Tip.isTouched() ) {
return 1;
}
return Part::BodyBase::mustExecute();
@@ -133,18 +133,13 @@ App::DocumentObject* Body::getPrevFeature(App::DocumentObject *start) const
App::DocumentObject* Body::getPrevSolidFeature(App::DocumentObject *start)
{
App::DocumentObject* baseFeature = BaseFeature.getValue();
if ( !start ) { // default to tip
start = Tip.getValue();
}
if ( !start ) { // No Tip
return nullptr;
} else if ( start == baseFeature ) { // The base feature always considered as the first solid
return nullptr;
}
if (!hasObject(start))
return nullptr;
@@ -156,15 +151,13 @@ App::DocumentObject* Body::getPrevSolidFeature(App::DocumentObject *start)
if (rvIt != features.rend()) { // the solid found in model list
return *rvIt;
} else { // if solid is not present in the list the previous one is baseFeature
return baseFeature; // return it either it's set or nullptr
}
return nullptr;
}
App::DocumentObject* Body::getNextSolidFeature(App::DocumentObject *start)
{
App::DocumentObject* baseFeature = BaseFeature.getValue();
if ( !start ) { // default to tip
start = Tip.getValue();
}
@@ -178,14 +171,9 @@ App::DocumentObject* Body::getNextSolidFeature(App::DocumentObject *start)
const std::vector<App::DocumentObject*> & features = Group.getValues();
std::vector<App::DocumentObject*>::const_iterator startIt;
if ( start == baseFeature ) {
// Handle the base feature, it's always considered to be solid
startIt = features.begin();
} else {
startIt = std::find ( features.begin(), features.end(), start );
assert ( startIt != features.end() );
startIt++;
}
startIt = std::find ( features.begin(), features.end(), start );
assert ( startIt != features.end() );
startIt++;
if (startIt == features.end() ) { // features list is empty
return nullptr;
@@ -195,9 +183,9 @@ App::DocumentObject* Body::getNextSolidFeature(App::DocumentObject *start)
if (rvIt != features.end()) { // the solid found in model list
return *rvIt;
} else {
return nullptr;
}
return nullptr;
}
bool Body::isAfterInsertPoint(App::DocumentObject* feature) {
@@ -299,18 +287,8 @@ std::vector< App::DocumentObject* > Body::addObjects(std::vector< App::DocumentO
void Body::insertObject(App::DocumentObject* feature, App::DocumentObject* target, bool after)
{
if (target) {
if (target == BaseFeature.getValue()) {
// Handle the insertion relative to the base feature in a special way
if (after) {
target = nullptr;
} else {
throw Base::Exception("Body: impossible to insert before the base object");
}
} else if (!hasObject (target)) {
// Check if the target feature belongs to the body
throw Base::Exception("Body: the feature we should insert relative to is not part of that body");
}
if (target && !hasObject (target)) {
throw Base::Exception("Body: the feature we should insert relative to is not part of that body");
}
//ensure that all origin links are ok
@@ -420,8 +398,7 @@ App::DocumentObjectExecReturn *Body::execute(void)
Part::TopoShape tipShape;
if ( tip ) {
if ( !tip->getTypeId().isDerivedFrom ( PartDesign::Feature::getClassTypeId() )
&& tip != BaseFeature.getValue () ) {
if ( !tip->getTypeId().isDerivedFrom ( PartDesign::Feature::getClassTypeId() ) ) {
return new App::DocumentObjectExecReturn ( "Linked object is not a PartDesign feature" );
}
@@ -454,11 +431,32 @@ void Body::onSettingDocument() {
void Body::onChanged (const App::Property* prop) {
if ( prop == &BaseFeature ) {
App::DocumentObject *baseFeature = BaseFeature.getValue();
App::DocumentObject *nextSolid = getNextSolidFeature ( baseFeature );
if ( nextSolid ) {
assert ( nextSolid->isDerivedFrom ( PartDesign::Feature::getClassTypeId () ) );
static_cast<PartDesign::Feature*>(nextSolid)->BaseFeature.setValue( baseFeature );
FeatureBase* bf = nullptr;
auto first = Group.getValues().empty() ? nullptr : Group.getValues().front();
if(BaseFeature.getValue()) {
//setup the FeatureBase if needed
if(!first || !first->isDerivedFrom(FeatureBase::getClassTypeId())) {
bf = static_cast<FeatureBase*>(getDocument()->addObject("PartDesign::FeatureBase", "BaseFeature"));
insertObject(bf, first, false);
if(!Tip.getValue())
Tip.setValue(bf);
}
else
bf = static_cast<FeatureBase*>(first);
}
if(bf && (bf->BaseFeature.getValue() != BaseFeature.getValue()))
bf->BaseFeature.setValue(BaseFeature.getValue());
}
else if( prop == &Group ) {
//if the FeatureBase was deleted we set the BaseFeature link to nullptr
if(BaseFeature.getValue() &&
(Group.getValues().empty() || !Group.getValues().front()->isDerivedFrom(FeatureBase::getClassTypeId()))) {
BaseFeature.setValue(nullptr);
}
}

View File

@@ -37,6 +37,8 @@ SET(Features_SRCS
FeatureSolid.h
Body.cpp
Body.h
FeatureBase.h
FeatureBase.cpp
)
SOURCE_GROUP("Features" FILES ${Features_SRCS})

View File

@@ -55,6 +55,7 @@ Feature::Feature()
{
ADD_PROPERTY(BaseFeature,(0));
Placement.setStatus(App::Property::Hidden, true);
BaseFeature.setStatus(App::Property::Hidden, true);
}
short Feature::mustExecute() const
@@ -176,6 +177,20 @@ TopoDS_Shape Feature::makeShapeFromPlane(const App::DocumentObject* obj)
return builder.Shape();
}
Body* Feature::getFeatureBody() {
auto list = getInList();
for (auto in : list) {
if(in->isDerivedFrom(Body::getClassTypeId()) && //is Body?
static_cast<Body*>(in)->hasObject(this)) { //is part of this Body?
return static_cast<Body*>(in);
}
}
return nullptr;
};
}//namespace PartDesign
namespace App {

View File

@@ -56,6 +56,9 @@ public:
/// Check whether the given feature is a datum feature
static bool isDatum(const App::DocumentObject* feature);
/// Returns the body the feature is in, or none
Body* getFeatureBody();
/**
* Returns the BaseFeature property's object (if any)
* @param silent if couldn't determine the base feature and silent == true,

View File

@@ -0,0 +1,97 @@
/***************************************************************************
* Copyright (c) 2017 Stefan Tröger <stefantroeger@gmx.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
# include <Standard_Failure.hxx>
#endif
#include <Base/Exception.h>
#include <App/FeaturePythonPyImp.h>
#include "Body.h"
#include "FeatureBase.h"
#include "FeaturePy.h"
namespace PartDesign {
PROPERTY_SOURCE(PartDesign::FeatureBase,PartDesign::Feature)
FeatureBase::FeatureBase()
{
BaseFeature.setScope(App::LinkScope::Global);
BaseFeature.setStatus(App::Property::Hidden, false);
}
Part::Feature* FeatureBase::getBaseObject(bool) const {
return nullptr;
}
short int FeatureBase::mustExecute(void) const {
if(BaseFeature.isTouched())
return 1;
return Part::Feature::mustExecute();
}
App::DocumentObjectExecReturn* FeatureBase::execute(void) {
if(!BaseFeature.getValue())
return new App::DocumentObjectExecReturn("BaseFeature link is not set");
if(!BaseFeature.getValue()->isDerivedFrom(Part::Feature::getClassTypeId()))
return new App::DocumentObjectExecReturn("BaseFeature must be a Part::Feature");
auto shape = static_cast<Part::Feature*>(BaseFeature.getValue())->Shape.getValue();
if(shape.IsNull())
return new App::DocumentObjectExecReturn("BaseFeature has a empty shape");
Shape.setValue(shape);
return StdReturn;
}
void FeatureBase::onChanged(const App::Property* prop) {
// the BaseFeature property should track the Body BaseFeature and vice-versa
if (prop == &BaseFeature) {
auto body = getFeatureBody();
if(!body)
return;
if (BaseFeature.getValue() && body->BaseFeature.getValue() != BaseFeature.getValue()) {
body->BaseFeature.setValue(BaseFeature.getValue());
}
}
Part::Feature::onChanged(prop);
}
}//namespace PartDesign

View File

@@ -0,0 +1,57 @@
/***************************************************************************
* Copyright (c) 2017 Stefan Tröger <stefantroeger@gmx.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef PARTDESIGN_FeatureBase_H
#define PARTDESIGN_FeatureBase_H
#include <App/PropertyStandard.h>
#include "Feature.h"
/// Base class of all additive features in PartDesign
namespace PartDesign
{
class PartDesignExport FeatureBase : public PartDesign::Feature
{
PROPERTY_HEADER(PartDesign::FeatureBase);
public:
FeatureBase();
virtual short int mustExecute(void) const;
virtual Part::Feature* getBaseObject(bool silent=false) const;
virtual const char* getViewProviderName() const {
return "PartDesignGui::ViewProviderBase";
}
virtual void onChanged(const App::Property* prop);
virtual App::DocumentObjectExecReturn* execute(void);
};
} //namespace PartDesign
#endif // PARTDESIGN_FeatureBase_H

View File

@@ -62,6 +62,7 @@
#include "ViewProviderPipe.h"
#include "ViewProviderLoft.h"
#include "ViewProviderShapeBinder.h"
#include "ViewProviderBase.h"
// use a different name to CreateCommand()
void CreatePartDesignCommands(void);
@@ -154,6 +155,7 @@ PyMOD_INIT_FUNC(PartDesignGui)
PartDesignGui::ViewProviderPrimitive ::init();
PartDesignGui::ViewProviderPipe ::init();
PartDesignGui::ViewProviderLoft ::init();
PartDesignGui::ViewProviderBase ::init();
// add resources and reloads the translators
loadPartDesignResource();

View File

@@ -158,6 +158,8 @@ SET(PartDesignGuiViewProvider_SRCS
ViewProviderPipe.cpp
ViewProviderLoft.h
ViewProviderLoft.cpp
ViewProviderBase.h
ViewProviderBase.cpp
)
SOURCE_GROUP("ViewProvider" FILES ${PartDesignGuiViewProvider_SRCS})

View File

@@ -49,6 +49,7 @@
<file>icons/PartDesign_Subtractive_Ellipsoid.svg</file>
<file>icons/PartDesign_Subtractive_Prism.svg</file>
<file>icons/PartDesign_Subtractive_Wedge.svg</file>
<file>icons/PartDesign_BaseFeature.svg</file>
<file>translations/PartDesign_af.qm</file>
<file>translations/PartDesign_de.qm</file>
<file>translations/PartDesign_fi.qm</file>

View File

@@ -0,0 +1,503 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="64px"
height="64px"
id="svg2980"
sodipodi:version="0.32"
inkscape:version="0.91 r13725"
sodipodi:docname="PartDesign_BaseFeature.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
version="1.1">
<defs
id="defs2982">
<linearGradient
id="linearGradient3864">
<stop
id="stop3866"
offset="0"
style="stop-color:#71b2f8;stop-opacity:1;" />
<stop
id="stop3868"
offset="1"
style="stop-color:#002795;stop-opacity:1;" />
</linearGradient>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 32 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="64 : 32 : 1"
inkscape:persp3d-origin="32 : 21.333333 : 1"
id="perspective2988" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3377-28"
id="linearGradient3616-9"
gradientUnits="userSpaceOnUse"
x1="901.1875"
y1="1190.875"
x2="1267.9062"
y2="1190.875"
gradientTransform="matrix(0.1367863,0,0,0.1367863,-122.45404,-135.82061)" />
<linearGradient
id="linearGradient3377-28">
<stop
id="stop3379-2"
offset="0"
style="stop-color:#ffaa00;stop-opacity:1;" />
<stop
id="stop3381-9"
offset="1"
style="stop-color:#faff2b;stop-opacity:1;" />
</linearGradient>
<linearGradient
gradientUnits="userSpaceOnUse"
y2="1190.875"
x2="1267.9062"
y1="1190.875"
x1="901.1875"
id="linearGradient3383-7"
xlink:href="#linearGradient3377-28"
inkscape:collect="always" />
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
id="perspective3607-8" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3377-2"
id="linearGradient3616"
gradientUnits="userSpaceOnUse"
x1="901.1875"
y1="1190.875"
x2="1267.9062"
y2="1190.875"
gradientTransform="matrix(0.1367863,0,0,0.1367863,-122.45404,-135.82061)" />
<linearGradient
id="linearGradient3377-2">
<stop
id="stop3379-6"
offset="0"
style="stop-color:#ffaa00;stop-opacity:1;" />
<stop
id="stop3381-7"
offset="1"
style="stop-color:#faff2b;stop-opacity:1;" />
</linearGradient>
<linearGradient
gradientUnits="userSpaceOnUse"
y2="1190.875"
x2="1267.9062"
y1="1190.875"
x1="901.1875"
id="linearGradient3383-6"
xlink:href="#linearGradient3377-2"
inkscape:collect="always" />
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
id="perspective3607" />
<radialGradient
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.4307499,-1.3605156e-7,1.202713e-8,0.1264801,-475.3928,1244.2826)"
r="194.40614"
fy="1424.4465"
fx="1103.6399"
cy="1424.4465"
cx="1103.6399"
id="radialGradient6355"
xlink:href="#linearGradient6349"
inkscape:collect="always" />
<inkscape:perspective
id="perspective5829"
inkscape:persp3d-origin="32 : 21.333333 : 1"
inkscape:vp_z="64 : 32 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 32 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
gradientUnits="userSpaceOnUse"
y2="1190.875"
x2="1267.9062"
y1="1190.875"
x1="901.1875"
id="linearGradient3383"
xlink:href="#linearGradient3377"
inkscape:collect="always" />
<linearGradient
id="linearGradient3377">
<stop
id="stop3379"
offset="0"
style="stop-color:#ffaa00;stop-opacity:1;" />
<stop
id="stop3381"
offset="1"
style="stop-color:#faff2b;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient6349"
inkscape:collect="always">
<stop
id="stop6351"
offset="0"
style="stop-color:#000000;stop-opacity:1;" />
<stop
id="stop6353"
offset="1"
style="stop-color:#000000;stop-opacity:0;" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3377"
id="linearGradient3025"
gradientUnits="userSpaceOnUse"
x1="901.1875"
y1="1190.875"
x2="1267.9062"
y2="1190.875" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3377-2"
id="linearGradient3027"
gradientUnits="userSpaceOnUse"
x1="901.1875"
y1="1190.875"
x2="1267.9062"
y2="1190.875" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3377-28"
id="linearGradient3029"
gradientUnits="userSpaceOnUse"
x1="901.1875"
y1="1190.875"
x2="1267.9062"
y2="1190.875" />
<linearGradient
gradientTransform="translate(-0.017371,-2.4277202)"
inkscape:collect="always"
xlink:href="#linearGradient3767"
id="linearGradient3773"
x1="22.116516"
y1="55.717518"
x2="17.328547"
y2="21.31134"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
id="linearGradient3767">
<stop
style="stop-color:#3465a4;stop-opacity:1"
offset="0"
id="stop3769" />
<stop
style="stop-color:#729fcf;stop-opacity:1"
offset="1"
id="stop3771" />
</linearGradient>
<linearGradient
gradientTransform="translate(-0.017371,-2.4277202)"
inkscape:collect="always"
xlink:href="#linearGradient3777"
id="linearGradient3783"
x1="53.896763"
y1="51.179787"
x2="47.502235"
y2="21.83742"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
id="linearGradient3777">
<stop
style="stop-color:#204a87;stop-opacity:1"
offset="0"
id="stop3779" />
<stop
style="stop-color:#3465a4;stop-opacity:1"
offset="1"
id="stop3781" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient3794"
id="radialGradient3800"
cx="1"
cy="45"
fx="1"
fy="45"
r="41"
gradientTransform="matrix(0.93348213,-2.2905276e-8,0,0.28687573,0.06651751,32.090592)"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
id="linearGradient3794">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop3796" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop3798" />
</linearGradient>
<radialGradient
r="41"
fy="45"
fx="1"
cy="45"
cx="1"
gradientTransform="matrix(0.93348213,-2.2905276e-8,0,0.28687573,0.06651751,32.090592)"
gradientUnits="userSpaceOnUse"
id="radialGradient3071"
xlink:href="#linearGradient3794"
inkscape:collect="always" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4991"
id="radialGradient4997"
cx="16.563837"
cy="11.132236"
fx="16.563837"
fy="11.132236"
r="19.0625"
gradientTransform="matrix(-0.01312985,1.685197,1.7434335,0.01311475,392.36263,74.217839)"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
id="linearGradient4991">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop4993" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop4995" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4991"
id="linearGradient1764"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,-1.171926,1.1926896,0,395.23697,138.43466)"
x1="17.060806"
y1="11.39502"
x2="12.624337"
y2="12.583769" />
<linearGradient
gradientTransform="matrix(1.0177175,0,0,1,393.42259,84.333549)"
inkscape:collect="always"
xlink:href="#linearGradient2240"
id="linearGradient2246"
x1="33"
y1="35.75"
x2="31.5"
y2="42.5"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
id="linearGradient2240">
<stop
style="stop-color:#99b00b;stop-opacity:1;"
offset="0"
id="stop2242" />
<stop
style="stop-color:#99b00b;stop-opacity:0;"
offset="1"
id="stop2244" />
</linearGradient>
<linearGradient
gradientTransform="matrix(1.0177175,0,0,1,393.42259,84.333549)"
inkscape:collect="always"
xlink:href="#linearGradient2232"
id="linearGradient2238"
x1="33"
y1="35.75"
x2="31.5"
y2="42.5"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
id="linearGradient2232">
<stop
style="stop-color:#788600;stop-opacity:1;"
offset="0"
id="stop2234" />
<stop
style="stop-color:#788600;stop-opacity:0;"
offset="1"
id="stop2236" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient6349"
id="radialGradient8668"
cx="24.837126"
cy="36.421127"
fx="24.837126"
fy="36.421127"
r="15.644737"
gradientTransform="matrix(1.5161304,0,0,0.53739498,380.55135,-142.75197)"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="3.8588775"
inkscape:cx="-46.608955"
inkscape:cy="24.985792"
inkscape:current-layer="g3973"
showgrid="true"
inkscape:document-units="px"
inkscape:grid-bbox="true"
inkscape:window-width="1848"
inkscape:window-height="1043"
inkscape:window-x="72"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:snap-bbox="true"
inkscape:snap-nodes="true">
<inkscape:grid
type="xygrid"
id="grid3088"
empspacing="2"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" />
</sodipodi:namedview>
<metadata
id="metadata2985">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:creator>
<cc:Agent>
<dc:title>[triplus]</dc:title>
</cc:Agent>
</dc:creator>
<dc:title>PartDesignWorkbench</dc:title>
<dc:date>2016-02-26</dc:date>
<dc:relation>http://www.freecadweb.org/wiki/index.php?title=Artwork</dc:relation>
<dc:publisher>
<cc:Agent>
<dc:title>FreeCAD</dc:title>
</cc:Agent>
</dc:publisher>
<dc:identifier>FreeCAD/src/Mod/PartDesign/Gui/Resources/icons/PartDesignWorkbench.svg</dc:identifier>
<dc:rights>
<cc:Agent>
<dc:title>FreeCAD LGPL2+</dc:title>
</cc:Agent>
</dc:rights>
<cc:license>https://www.gnu.org/copyleft/lesser.html</cc:license>
<dc:contributor>
<cc:Agent>
<dc:title>[agryson] Alexander Gryson</dc:title>
</cc:Agent>
</dc:contributor>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
sodipodi:type="arc"
style="fill:url(#radialGradient3071);fill-opacity:1;stroke:none"
id="path3024"
sodipodi:cx="1"
sodipodi:cy="45"
sodipodi:rx="41"
sodipodi:ry="13"
d="m 42,45 a 41,13 0 1 1 -82,0 41,13 0 1 1 82,0 z"
transform="matrix(0.73170732,0,0,0.80769231,31.250922,16.726126)" />
<path
style="fill:#729fcf;stroke:#0b1521;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1"
d="m 2.982629,14.57228 34,6 23.999999,-8 -29.999999,-4 z"
id="path2993"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
style="fill:url(#linearGradient3783);fill-opacity:1;stroke:#0b1521;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1"
d="m 60.982628,12.57228 0,36 -23.999999,10 0,-38 z"
id="path2995"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc"
id="path3825-3"
d="m 2.982629,14.57228 34,6 0,38 -34,-6 z"
style="fill:url(#linearGradient3773);fill-opacity:1;fill-rule:evenodd;stroke:#0b1521;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<path
style="fill:none;stroke:#729fcf;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 4.982629,17 4.991329,50.919116 35,56.187915 34.9913,22.254301 z"
id="path3765"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
style="fill:none;stroke:#3465a4;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 38.995059,22.006113 -0.01226,33.535301 20.001109,-8.300993 3.6e-4,-31.867363 z"
id="path3775"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<g
id="g3973"
transform="matrix(0.98259094,0,0,1,-534.57346,-68.336561)">
<g
id="g4239"
transform="matrix(1.3891611,0,0,1.2692787,-11.89428,-25.845247)">
<ellipse
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:0.14117647;fill:url(#radialGradient8668);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none"
id="path8660"
transform="scale(1,-1)"
cx="418.20767"
cy="-123.17942"
rx="23.719461"
ry="8.4074068" />
<path
sodipodi:nodetypes="ccccccc"
id="path1432"
d="m 432.47725,129.36792 c -40.73497,1.32114 -34.29704,-32.740821 -13.10817,-32.536721 l 0,-9.37541 16.94345,14.586581 -16.94345,15.29753 c 0,0 0,-9.66838 0,-9.66838 -14.31227,-0.58597 -18.49959,21.43258 13.10817,21.6964 z"
style="color:#000000;display:block;overflow:visible;visibility:visible;opacity:1;fill:url(#linearGradient2246);fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient2238);stroke-width:1.00881994;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none"
inkscape:connector-curvature="0" />
<path
style="color:#000000;display:block;overflow:visible;visibility:visible;opacity:0.69886361;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:url(#linearGradient1764);stroke-width:1.00881958;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none"
d="m 410.64737,123.64907 c -11.9308,-6.07963 -8.33286,-26.228032 9.75338,-25.765562 l 0,-8.099091 c 0,0 14.29663,12.263723 14.29663,12.263723 l -14.29663,12.94403 c 0,0 0,-8.27764 0,-8.27764 -15.10278,-0.34827 -14.41079,12.7576 -9.75338,16.93454 z"
id="path2177"
sodipodi:nodetypes="ccccccc"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="ccccccc"
id="path4989"
d="m 419.92088,88.902159 10.87608,10.229631 c -7.06041,-10e-7 -4.76977,8.93718 -11.00329,11.81218 l 0.0636,-3.66681 c -15.45659,-0.0625 -14.56609,15.5 -3.30759,19.75 -19.42634,-4.88193 -16.72873,-29.312502 3.24398,-29.812501 l 0.12721,-8.3125 z"
style="color:#000000;display:inline;overflow:visible;visibility:visible;opacity:0.49431817;fill:url(#radialGradient4997);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.9999997;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;marker-start:none;marker-mid:none;marker-end:none"
inkscape:connector-curvature="0" />
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -0,0 +1,45 @@
/***************************************************************************
* Copyright (c) 2017 Stefan Tröger <stefantroeger@gmx.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#endif
#include "ViewProviderBase.h"
using namespace PartDesignGui;
PROPERTY_SOURCE(PartDesignGui::ViewProviderBase,PartDesignGui::ViewProvider)
ViewProviderBase::ViewProviderBase()
{
sPixmap = "PartDesign_BaseFeature.svg";
}
ViewProviderBase::~ViewProviderBase()
{
}

View File

@@ -0,0 +1,46 @@
/***************************************************************************
* Copyright (c) 2017 Stefan Tröger <stefantroeger@gmx.net> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef PARTGUI_ViewProviderBase_H
#define PARTGUI_ViewProviderBase_H
#include "ViewProvider.h"
namespace PartDesignGui {
class PartDesignGuiExport ViewProviderBase : public ViewProvider
{
PROPERTY_HEADER(PartDesignGui::ViewProviderBase);
public:
/// constructor
ViewProviderBase();
/// destructor
virtual ~ViewProviderBase();
};
} // namespace PartDesignGui
#endif // PARTGUI_ViewProviderBase_H

View File

@@ -200,9 +200,6 @@ std::vector<App::DocumentObject*> ViewProviderBody::claimChildren(void)const
if (body->Origin.getValue()) { // Clame for the Origin
Result.push_back (body->Origin.getValue());
}
if (body->BaseFeature.getValue()) { // Clame for the base feature
Result.push_back (body->BaseFeature.getValue());
}
// claim for rest content not claimed by any other features
std::remove_copy_if (model.begin(), model.end(), std::back_inserter (Result),