#include <SketchPlugin_ConstraintCoincidence.h>
#include <SketchPlugin_ConstraintTangent.h>
-/// Obtain constraints prepared by tangent arc
-static std::list<FeaturePtr> tangentArcConstraints(const FeaturePtr& theArc);
-
//================================================================================================
SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature> & theFeature)
: SketchAPI_SketchEntity(theFeature)
#include <SketchPlugin_ConstraintCoincidence.h>
#include <SketchPlugin_ConstraintTangent.h>
-/// Obtain constraints prepared by tangent arc
-static std::list<FeaturePtr> tangentArcConstraints(const FeaturePtr& theArc);
-
//================================================================================================
SketchAPI_MacroArc::SketchAPI_MacroArc(const std::shared_ptr<ModelAPI_Feature> & theFeature)
: SketchAPI_SketchEntity(theFeature)
bool theInversed)
{
fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_TANGENT_EDGE(), myarcType);
- fillAttribute(theTangentPoint, mytangentPoint);
+ fillAttribute(theTangentPoint, mytransversalPoint);
fillAttribute(theEnd, myendPoint3);
fillAttribute(theInversed, myreversed);
bool theInversed)
{
fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_TRANSVERSAL_LINE(), myarcType);
- fillAttribute(theTransversalPoint, mytangentPoint);
- fillAttribute(endPoint3(), theEndX, theEndY);
+ fillAttribute(theTransversalPoint, mytransversalPoint);
+ fillAttribute(endPoint4(), theEndX, theEndY);
fillAttribute(theInversed, myreversed);
execute();
bool theInversed)
{
fillAttribute(SketchPlugin_MacroArc::ARC_TYPE_BY_TRANSVERSAL_LINE(), myarcType);
- fillAttribute(theTransversalPoint, mytangentPoint);
- fillAttribute(theEnd, myendPoint3);
+ fillAttribute(theTransversalPoint, mytransversalPoint);
+ fillAttribute(theEnd, myendPoint4);
fillAttribute(theInversed, myreversed);
execute();
SKETCHAPI_EXPORT
virtual ~SketchAPI_MacroArc();
- INTERFACE_12(SketchPlugin_MacroArc::ID(),
+ INTERFACE_14(SketchPlugin_MacroArc::ID(),
arcType, SketchPlugin_MacroArc::ARC_TYPE(),
ModelAPI_AttributeString, /** Arc type */,
center, SketchPlugin_MacroArc::CENTER_POINT_ID(),
ModelAPI_AttributeRefAttr, /** Tangent point */,
endPoint3, SketchPlugin_MacroArc::END_POINT_3_ID(),
GeomDataAPI_Point2D, /** End point */,
+ transversalPoint, SketchPlugin_MacroArc::TRANSVERSAL_POINT_ID(),
+ ModelAPI_AttributeRefAttr, /** Transversal point */,
+ endPoint4, SketchPlugin_MacroArc::END_POINT_4_ID(),
+ GeomDataAPI_Point2D, /** End point */,
reversed, SketchPlugin_MacroArc::REVERSED_ID(),
ModelAPI_AttributeBoolean, /** Reversed flag */,
radius, SketchPlugin_MacroArc::RADIUS_ID(),
data()->addAttribute(TANGENT_POINT_ID(), ModelAPI_AttributeRefAttr::typeId());
data()->addAttribute(END_POINT_3_ID(), GeomDataAPI_Point2D::typeId());
+ data()->addAttribute(TRANSVERSAL_POINT_ID(), ModelAPI_AttributeRefAttr::typeId());
+ data()->addAttribute(END_POINT_4_ID(), GeomDataAPI_Point2D::typeId());
+
data()->addAttribute(REVERSED_ID(), ModelAPI_AttributeBoolean::typeId());
data()->addAttribute(RADIUS_ID(), ModelAPI_AttributeDouble::typeId());
SketchPlugin_Tools::resetAttribute(this, PASSED_POINT_REF_ID());
SketchPlugin_Tools::resetAttribute(this, TANGENT_POINT_ID());
SketchPlugin_Tools::resetAttribute(this, END_POINT_3_ID());
+ SketchPlugin_Tools::resetAttribute(this, TRANSVERSAL_POINT_ID());
+ SketchPlugin_Tools::resetAttribute(this, END_POINT_4_ID());
SketchPlugin_Tools::resetAttribute(this, REVERSED_ID());
SketchPlugin_Tools::resetAttribute(this, RADIUS_ID());
SketchPlugin_Tools::resetAttribute(this, ANGLE_ID());
true);
} else {
// coincident with connection point
+ const std::string& aPointAttr = anArcType == ARC_TYPE_BY_TANGENT_EDGE() ?
+ TANGENT_POINT_ID() : TRANSVERSAL_POINT_ID();
SketchPlugin_Tools::createCoincidenceOrTangency(this,
- TANGENT_POINT_ID(),
+ aPointAttr,
anArcFeature->attribute(SketchPlugin_Arc::START_ID()),
ObjectPtr(),
false);
// setting attributes of the start point constraint
AttributeRefAttrPtr aRefAttrA =
aStartPointConstraint->refattr(SketchPlugin_Constraint::ENTITY_A());
- AttributeRefAttrPtr aTgPntRefAttr = refattr(TANGENT_POINT_ID());
+ AttributeRefAttrPtr aTgPntRefAttr = refattr(aPointAttr);
FeaturePtr aTgFeature = ModelAPI_Feature::feature(aTgPntRefAttr->attr()->owner());
aRefAttrA->setObject(aTgFeature->lastResult());
AttributeRefAttrPtr aRefAttrB =
aFilledAttributeName = ARC_TYPE();
if(anArcType == ARC_TYPE_BY_TANGENT_EDGE()) {
aFilledAttributeName = TANGENT_POINT_ID();
- AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
- attribute(aFilledAttributeName));
+ AttributeRefAttrPtr aRefAttr = refattr(aFilledAttributeName);
FeaturePtr aCreatedFeature = aReentrantMessage->createdFeature();
aRefAttr->setAttr(aCreatedFeature->attribute(SketchPlugin_Arc::END_ID()));
}
+ else if (anArcType == ARC_TYPE_BY_TRANSVERSAL_LINE()) {
+ AttributeRefAttrPtr aRefAttr = refattr(TRANSVERSAL_POINT_ID());
+ AttributePtr anAttribute = aReentrantMessage->selectedAttribute();
+ if (anAttribute) {
+ aRefAttr->setAttr(anAttribute);
+ aFilledAttributeName = TRANSVERSAL_POINT_ID();
+ }
+ }
else {
ObjectPtr anObject = aReentrantMessage->selectedObject();
AttributePtr anAttribute = aReentrantMessage->selectedAttribute();
void SketchPlugin_MacroArc::fillByEdge(bool theTransversal)
{
- AttributeRefAttrPtr aTangentAttr = refattr(TANGENT_POINT_ID());
+ const std::string& aStartPoint = theTransversal ? TRANSVERSAL_POINT_ID() : TANGENT_POINT_ID();
+ const std::string& aEndPoint = theTransversal ? END_POINT_4_ID() : END_POINT_3_ID();
+
+ AttributeRefAttrPtr aTangentAttr = refattr(aStartPoint);
if (!aTangentAttr->isInitialized())
return;
return;
AttributePoint2DPtr anEndPointAttr =
- std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(END_POINT_3_ID()));
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(aEndPoint));
if (!anEndPointAttr->isInitialized())
return;
return ID;
}
+ /// End 2D point of the arc
+ inline static const std::string& END_POINT_4_ID()
+ {
+ static const std::string ID = "end_point_4";
+ return ID;
+ }
+
inline static const std::string& END_POINT_REF_ID()
{
static const std::string ID = "end_point_ref";
return ID;
}
+ static const std::string& TRANSVERSAL_POINT_ID()
+ {
+ static const std::string ID("transversal_point");
+ return ID;
+ }
+
/// Reversed flag
inline static const std::string& REVERSED_ID()
{
<box id="by_transversal_line"
icon="icons/Sketch/arc_perp_32x32.png"
title="Perpendicular to line">
- <sketch_shape_selector id="tangent_point"
+ <sketch_shape_selector id="transversal_point"
label="Point on the perpendicular line"
tooltip="Select point on line"
shape_types="vertex">
<validator id="SketchPlugin_ArcTransversalPoint"/>
</sketch_shape_selector>
- <sketch-2dpoint_selector id="end_point_3"
+ <sketch-2dpoint_selector id="end_point_4"
reference_attribute="end_point_ref"
title="End point"
tooltip="End point"