Sketcher: change Support from PropertyLinkSub to PropertyLinkSubList
Note: may fail to build after this commit...
This commit is contained in:
parent
ac5730996d
commit
061747f367
|
@ -64,7 +64,6 @@ PROPERTY_SOURCE(Part::Part2DObject, Part::Feature)
|
|||
|
||||
Part2DObject::Part2DObject()
|
||||
{
|
||||
ADD_PROPERTY_TYPE(Support,(0), "2D",(App::PropertyType)(App::Prop_None),"Support of the 2D geometry");
|
||||
}
|
||||
|
||||
|
||||
|
@ -75,12 +74,16 @@ App::DocumentObjectExecReturn *Part2DObject::execute(void)
|
|||
|
||||
void Part2DObject::positionBySupport(void)
|
||||
{
|
||||
AttachableObject::positionBySupport();
|
||||
|
||||
return;
|
||||
/*
|
||||
// recalculate support:
|
||||
Base::Placement Place;
|
||||
TopoDS_Shape sh;
|
||||
bool Reverse = false;
|
||||
gp_Pln plane;
|
||||
App::DocumentObject* support = Support.getValue();
|
||||
App::DocumentObject* support = Support.getValues();
|
||||
if (support == NULL)
|
||||
return;
|
||||
|
||||
|
@ -229,13 +232,13 @@ void Part2DObject::positionBySupport(void)
|
|||
//Standard_Real a = Normal.Angle(gp_Ax1(gp_Pnt(0,0,0),gp_Dir(0,0,1)));
|
||||
|
||||
Placement.setValue(Base::Placement(mtrx));
|
||||
*/
|
||||
}
|
||||
|
||||
void Part2DObject::transformPlacement(const Base::Placement &transform)
|
||||
{
|
||||
Part::Feature *part = static_cast<Part::Feature*>(Support.getValue());
|
||||
if (part && part->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
|
||||
part->transformPlacement(transform);
|
||||
if (Support.getValues().size() > 0) {
|
||||
//part->transformPlacement(transform);
|
||||
positionBySupport();
|
||||
} else
|
||||
GeoFeature::transformPlacement(transform);
|
||||
|
@ -370,7 +373,7 @@ void Part2DObject::acceptGeometry()
|
|||
void Part2DObject::onChanged(const App::Property* prop)
|
||||
{
|
||||
// Update the Placement if the Support changes
|
||||
if ((prop == &Support) && (Support.getValue() != NULL))
|
||||
if ((prop == &Support) && (Support.getValues().size() > 0))
|
||||
positionBySupport();
|
||||
Part::Feature::onChanged(prop);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <Base/Axis.h>
|
||||
|
||||
#include "PartFeature.h"
|
||||
#include "Attacher.h"
|
||||
|
||||
class TopoDS_Face;
|
||||
|
||||
|
@ -49,28 +50,15 @@ class Geometry;
|
|||
* geometry as its descend Sketcher::SketchObject .
|
||||
*/
|
||||
|
||||
class PartExport Part2DObject : public Part::Feature
|
||||
class PartExport Part2DObject : public Part::AttachableObject
|
||||
{
|
||||
PROPERTY_HEADER(Part::Part2DObject);
|
||||
|
||||
public:
|
||||
Part2DObject();
|
||||
|
||||
/// if the 2DObject lies on the Face of an other object this links to it
|
||||
App::PropertyLinkSub Support;
|
||||
void positionBySupport();
|
||||
|
||||
/** calculate and update the Placement property based on the Support
|
||||
* this methode will calculate the position of the
|
||||
* 2D shape on a supporting Face. The Normal(Orientation) get
|
||||
* extracted from the Face and for the position an educated guess is made,
|
||||
* by examining the placement of the support object (not only the face).
|
||||
* If the support is changed this methode is called do determine a new
|
||||
* postion of the 2D shape on the supporting Face
|
||||
*/
|
||||
void positionBySupport(void);
|
||||
/** applies a transform on the Placement of the Sketch or its
|
||||
* support if it has one
|
||||
*/
|
||||
virtual void transformPlacement(const Base::Placement &transform);
|
||||
|
||||
/// returns the number of construction lines (to be used as axes)
|
||||
|
|
|
@ -128,8 +128,7 @@ SketchObject::~SketchObject()
|
|||
App::DocumentObjectExecReturn *SketchObject::execute(void)
|
||||
{
|
||||
try {
|
||||
App::DocumentObject* support = Support.getValue();
|
||||
if (support)
|
||||
if (Support.getSize() > 0)
|
||||
this->positionBySupport();
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user