make origin work correct with multiple parts

This commit is contained in:
Stefan Tröger
2015-05-25 16:12:27 +02:00
parent 60686fe699
commit eba61e360d
20 changed files with 416 additions and 269 deletions

View File

@@ -342,11 +342,11 @@ void CoordinateSystem::onChanged(const App::Property *prop)
if(!plane) {
gp_Pnt base(0,0,0);
gp_Dir dir(0,0,1);
if (strcmp(p->getNameInDocument(), App::Part::BaseplaneTypes[0]) == 0)
if (strcmp(p->PlaneType.getValue(), App::Part::BaseplaneTypes[0]) == 0)
dir = gp_Dir(0,0,1);
else if (strcmp(p->getNameInDocument(), App::Part::BaseplaneTypes[1]) == 0)
else if (strcmp(p->PlaneType.getValue(), App::Part::BaseplaneTypes[1]) == 0)
dir = gp_Dir(0,1,0);
else if (strcmp(p->getNameInDocument(), App::Part::BaseplaneTypes[2]) == 0)
else if (strcmp(p->PlaneType.getValue(), App::Part::BaseplaneTypes[2]) == 0)
dir = gp_Dir(1,0,0);
pln = gp_Pln(base, dir);
@@ -372,11 +372,11 @@ void CoordinateSystem::onChanged(const App::Property *prop)
App::Line* p = static_cast<App::Line*>(refs[i]);
gp_Pnt base(0,0,0);
gp_Dir dir(0,0,1);
if (strcmp(p->getNameInDocument(), App::Part::BaselineTypes[0]) == 0)
if (strcmp(p->LineType.getValue(), App::Part::BaselineTypes[0]) == 0)
dir = gp_Dir(1,0,0);
else if (strcmp(p->getNameInDocument(), App::Part::BaselineTypes[1]) == 0)
else if (strcmp(p->LineType.getValue(), App::Part::BaselineTypes[1]) == 0)
dir = gp_Dir(0,1,0);
else if (strcmp(p->getNameInDocument(), App::Part::BaselineTypes[2]) == 0)
else if (strcmp(p->LineType.getValue(), App::Part::BaselineTypes[2]) == 0)
dir = gp_Dir(0,0,1);
if(!line1) {

View File

@@ -166,7 +166,7 @@ void Line::onChanged(const App::Property *prop)
std::set<QString> hint = getHint();
if (!((hint.size() == 1) && (hint.find(QObject::tr("Done")) != hint.end())))
throw Base::Exception("Incomplete References"); // incomplete references
return; // incomplete references
// Extract the geometry of the references
Base::Vector3d* base = NULL;
@@ -212,11 +212,11 @@ void Line::onChanged(const App::Property *prop)
} else if (refs[i]->getTypeId().isDerivedFrom(App::Line::getClassTypeId())) {
App::Line* l = static_cast<App::Line*>(refs[i]);
gp_Dir ldir;
if (strcmp(l->getNameInDocument(), App::Part::BaselineTypes[0]) == 0)
if (strcmp(l->LineType.getValue(), App::Part::BaselineTypes[0]) == 0)
ldir = gp_Dir(1,0,0);
else if (strcmp(l->getNameInDocument(), App::Part::BaselineTypes[1]) == 0)
else if (strcmp(l->LineType.getValue(), App::Part::BaselineTypes[1]) == 0)
ldir = gp_Dir(0,1,0);
else if (strcmp(l->getNameInDocument(), App::Part::BaselineTypes[2]) == 0)
else if (strcmp(l->LineType.getValue(), App::Part::BaselineTypes[2]) == 0)
ldir = gp_Dir(0,0,1);
if (s1.IsNull()) {
@@ -259,11 +259,11 @@ void Line::onChanged(const App::Property *prop)
// Note: We only handle the three base planes here
gp_Pnt base(0,0,0);
gp_Dir normal;
if (strcmp(p->getNameInDocument(), App::Part::BaseplaneTypes[0]) == 0)
if (strcmp(p->PlaneType.getValue(), App::Part::BaseplaneTypes[0]) == 0)
normal = gp_Dir(0,0,1);
else if (strcmp(p->getNameInDocument(), App::Part::BaseplaneTypes[2]) == 0)
else if (strcmp(p->PlaneType.getValue(), App::Part::BaseplaneTypes[2]) == 0)
normal = gp_Dir(1,0,0);
else if (strcmp(p->getNameInDocument(), App::Part::BaseplaneTypes[1]) == 0)
else if (strcmp(p->PlaneType.getValue(), App::Part::BaseplaneTypes[1]) == 0)
normal = gp_Dir(0,1,0);
double offset1 = Offset.getValue();

View File

@@ -226,11 +226,11 @@ void Plane::onChanged(const App::Property *prop)
App::Line* l = static_cast<App::Line*>(refs[i]);
Base::Vector3d base = Base::Vector3d(0,0,0);
gp_Dir dir;
if (strcmp(l->getNameInDocument(), App::Part::BaselineTypes[0]) == 0)
if (strcmp(l->LineType.getValue(), App::Part::BaselineTypes[0]) == 0)
dir = gp_Dir(1,0,0);
else if (strcmp(l->getNameInDocument(), App::Part::BaselineTypes[1]) == 0)
else if (strcmp(l->LineType.getValue(), App::Part::BaselineTypes[1]) == 0)
dir = gp_Dir(0,1,0);
else if (strcmp(l->getNameInDocument(), App::Part::BaselineTypes[2]) == 0)
else if (strcmp(l->LineType.getValue(), App::Part::BaselineTypes[2]) == 0)
dir = gp_Dir(0,0,1);
line = new gp_Lin(gp_Pnt(base.x, base.y, base.z), gp_Dir(dir.X(), dir.Y(), dir.Z()));
} else if (refs[i]->getTypeId().isDerivedFrom(PartDesign::Plane::getClassTypeId())) {
@@ -242,11 +242,11 @@ void Plane::onChanged(const App::Property *prop)
// Note: We only handle the three base planes here
p1 = new Base::Vector3d(0,0,0);
normal = new Base::Vector3d;
if (strcmp(p->getNameInDocument(), App::Part::BaseplaneTypes[0]) == 0)
if (strcmp(p->PlaneType.getValue(), App::Part::BaseplaneTypes[0]) == 0)
*normal = Base::Vector3d(0,0,1);
else if (strcmp(p->getNameInDocument(), App::Part::BaseplaneTypes[2]) == 0)
else if (strcmp(p->PlaneType.getValue(), App::Part::BaseplaneTypes[2]) == 0)
*normal = Base::Vector3d(0,1,0);
else if (strcmp(p->getNameInDocument(), App::Part::BaseplaneTypes[1]) == 0)
else if (strcmp(p->PlaneType.getValue(), App::Part::BaseplaneTypes[1]) == 0)
*normal = Base::Vector3d(1,0,0);
} else if (refs[i]->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
Part::Feature* feature = static_cast<Part::Feature*>(refs[i]);

View File

@@ -205,11 +205,11 @@ void Point::onChanged(const App::Property* prop)
// Note: We only handle the three base planes here
gp_Pnt base(0,0,0);
gp_Dir normal;
if (strcmp(l->getNameInDocument(), App::Part::BaselineTypes[0]) == 0)
if (strcmp(l->LineType.getValue(), App::Part::BaselineTypes[0]) == 0)
normal = gp_Dir(1,0,0);
else if (strcmp(l->getNameInDocument(), App::Part::BaselineTypes[1]) == 0)
else if (strcmp(l->LineType.getValue(), App::Part::BaselineTypes[1]) == 0)
normal = gp_Dir(0,1,0);
else if (strcmp(l->getNameInDocument(), App::Part::BaselineTypes[2]) == 0)
else if (strcmp(l->LineType.getValue(), App::Part::BaselineTypes[2]) == 0)
normal = gp_Dir(0,0,1);
if (s1.IsNull())
@@ -222,11 +222,11 @@ void Point::onChanged(const App::Property* prop)
// Note: We only handle the three base planes here
gp_Pnt base(0,0,0);
gp_Dir normal;
if (strcmp(p->getNameInDocument(), App::Part::BaseplaneTypes[0]) == 0)
if (strcmp(p->PlaneType.getValue(), App::Part::BaseplaneTypes[0]) == 0)
normal = gp_Dir(0,0,1);
else if (strcmp(p->getNameInDocument(), App::Part::BaseplaneTypes[2]) == 0)
else if (strcmp(p->PlaneType.getValue(), App::Part::BaseplaneTypes[2]) == 0)
normal = gp_Dir(1,0,0);
else if (strcmp(p->getNameInDocument(), App::Part::BaseplaneTypes[1]) == 0)
else if (strcmp(p->PlaneType.getValue(), App::Part::BaseplaneTypes[1]) == 0)
normal = gp_Dir(0,1,0);
if (s1.IsNull())

View File

@@ -1048,11 +1048,11 @@ void SketchBased::getAxis(const App::DocumentObject *pcReferenceAxis, const std:
else if (pcReferenceAxis->getTypeId().isDerivedFrom(App::Line::getClassTypeId())) {
const App::Line* line = static_cast<const App::Line*>(pcReferenceAxis);
base = Base::Vector3d(0,0,0);
if( strcmp(line->getNameInDocument(), App::Part::BaselineTypes[0]) == 0)
if( strcmp(line->LineType.getValue(), App::Part::BaselineTypes[0]) == 0)
dir = Base::Vector3d(1,0,0);
else if( strcmp(line->getNameInDocument(), App::Part::BaselineTypes[1]) == 0)
else if( strcmp(line->LineType.getValue(), App::Part::BaselineTypes[1]) == 0)
dir = Base::Vector3d(0,1,0);
else if( strcmp(line->getNameInDocument(), App::Part::BaselineTypes[2]) == 0)
else if( strcmp(line->LineType.getValue(), App::Part::BaselineTypes[2]) == 0)
dir = Base::Vector3d(0,0,1);
// Check that axis is perpendicular with sketch plane!