Attacher: line and point AttachEngines. Other changes.

* propose attachment modes
* refactor setUp and Copy
* split off postprocessing from 3D to reuse in 1D and 0D calculations
* AttachableObject: fix error printout in onChange
* AttachableObject: no more defaults to Attacher3D
* implementation of lines and points attachment (some of the proposed modes).
* refactor getShapeType, add getShapeType(obj, sub); add a flag to eRefType enum, indicating that referenced thing is a whole object that has placement.
* change readLinks to be static, and obtain shape types in the process.
* test mode enums lengths equality
* extend ObjectXY to work on conics.
* Fix upside-down sketches attached as TangentPlane on most shapes.
* Fix crash when a shape of unlisted type is in the links.
* fix attaching to datum lines go crazy because of infinities.
* abs->fabs
* support for App::Line
* Add namespace qualifiers to TYPESYSTEM_SOURCE-like stuff
This commit is contained in:
DeepSOIC
2015-07-02 21:37:45 +03:00
committed by Stefan Tröger
parent 50e6764cd0
commit d009a5cd3d
5 changed files with 934 additions and 236 deletions

View File

@@ -43,6 +43,8 @@ AttachableObject::AttachableObject()
ADD_PROPERTY_TYPE(MapMode, (mmDeactivated), "Attachment", App::Prop_None, "Mode of attachment to other object");
MapMode.setEnums(AttachEngine::eMapModeStrings);
//a rough test if mode string list in Attacher.cpp is in sync with eMapMode enum.
assert(MapMode.getEnumVector().size() == mmDummy_NumberOfModes);
ADD_PROPERTY_TYPE(MapReversed, (false), "Attachment", App::Prop_None, "Reverse Z direction (flip sketch upside down)");
@@ -50,7 +52,7 @@ AttachableObject::AttachableObject()
ADD_PROPERTY_TYPE(superPlacement, (Base::Placement()), "Attachment", App::Prop_None, "Extra placement to apply in addition to attachment (in local coordinates)");
setAttacher(new AttachEngine3D);//default attacher
//setAttacher(new AttachEngine3D);//default attacher
}
AttachableObject::~AttachableObject()
@@ -70,7 +72,7 @@ void AttachableObject::setAttacher(AttachEngine* attacher)
void AttachableObject::positionBySupport()
{
if (!_attacher)
return;
throw Base::Exception("AttachableObject: can't positionBySupport, because no AttachEngine is set.");
updateAttacherVals();
try{
this->Placement.setValue(_attacher->calculateAttachedPlacement(this->Placement.getValue()));
@@ -105,11 +107,11 @@ void AttachableObject::onChanged(const App::Property* prop)
positionBySupport();
} catch (Base::Exception &e) {
this->setError();
Base::Console().Error("PositionBySupport: &s",e.what());
Base::Console().Error("PositionBySupport: %s",e.what());
//set error message - how?
} catch (Standard_Failure &e){
this->setError();
Base::Console().Error("PositionBySupport: &s",e.GetMessageString());
Base::Console().Error("PositionBySupport: %s",e.GetMessageString());
}
}
Part::Feature::onChanged(prop);