PartDesign: Primitives are attachable directly
With the recently introduced AttachExtension the PartDesign primitives can be attachable by themself and don't need anymore the helping coordinate system datum. This simplyfies the code and the TreeView largely
This commit is contained in:
@@ -59,12 +59,12 @@ const App::PropertyQuantityConstraint::Constraints angleRangeU = {0.0,360.0,1.0}
|
||||
const App::PropertyQuantityConstraint::Constraints angleRangeV = {-90.0,90.0,1.0};
|
||||
const App::PropertyQuantityConstraint::Constraints quantityRange = {0.0,FLT_MAX,0.1};
|
||||
|
||||
PROPERTY_SOURCE(PartDesign::FeaturePrimitive, PartDesign::FeatureAddSub)
|
||||
PROPERTY_SOURCE_WITH_EXTENSIONS(PartDesign::FeaturePrimitive, PartDesign::FeatureAddSub)
|
||||
|
||||
FeaturePrimitive::FeaturePrimitive()
|
||||
: primitiveType(Box)
|
||||
{
|
||||
ADD_PROPERTY_TYPE(CoordinateSystem, (0), "Primitive", App::Prop_None, "References to build the location of the primitive");
|
||||
Part::AttachExtension::initExtension(this);
|
||||
}
|
||||
|
||||
TopoDS_Shape FeaturePrimitive::refineShapeIfActive(const TopoDS_Shape& oldShape) const
|
||||
@@ -84,11 +84,7 @@ App::DocumentObjectExecReturn* FeaturePrimitive::execute(const TopoDS_Shape& pri
|
||||
{
|
||||
try {
|
||||
//transform the primitive in the correct coordinance
|
||||
App::DocumentObject* cs = CoordinateSystem.getValue();
|
||||
if(cs && cs->getTypeId() == PartDesign::CoordinateSystem::getClassTypeId())
|
||||
Placement.setValue(static_cast<PartDesign::CoordinateSystem*>(cs)->Placement.getValue());
|
||||
else
|
||||
Placement.setValue(Base::Placement());
|
||||
FeatureAddSub::execute();
|
||||
|
||||
//if we have no base we just add the standard primitive shape
|
||||
TopoDS_Shape base;
|
||||
|
||||
@@ -28,13 +28,14 @@
|
||||
#include <App/PropertyUnits.h>
|
||||
|
||||
#include "FeatureAddSub.h"
|
||||
#include <Mod/Part/App/AttachExtension.h>
|
||||
|
||||
namespace PartDesign
|
||||
{
|
||||
|
||||
class PartDesignExport FeaturePrimitive : public PartDesign::FeatureAddSub
|
||||
class PartDesignExport FeaturePrimitive : public PartDesign::FeatureAddSub, public Part::AttachExtension
|
||||
{
|
||||
PROPERTY_HEADER(PartDesign::FeaturePrimitive);
|
||||
PROPERTY_HEADER_WITH_EXTENSIONS(PartDesign::FeaturePrimitive);
|
||||
|
||||
public:
|
||||
enum Type {
|
||||
@@ -57,9 +58,6 @@ public:
|
||||
TopoDS_Shape refineShapeIfActive(const TopoDS_Shape& oldShape) const;
|
||||
virtual void onChanged(const App::Property* prop);
|
||||
|
||||
/// The references datum defining the primtive location
|
||||
App::PropertyLink CoordinateSystem;
|
||||
|
||||
/// Do nothing, just to suppress warning, must be redefined in derived classes
|
||||
virtual App::DocumentObjectExecReturn* execute() {
|
||||
return PartDesign::FeatureAddSub::execute();
|
||||
|
||||
Reference in New Issue
Block a user