<qresource>
<file>icons/angle.png</file>
<file>icons/angle_32x32.png</file>
+ <file>icons/angle_backward.png</file>
<file>icons/angle_up.png</file>
+ <file>icons/angle_direct.png</file>
<file>icons/angle_down.png</file>
+ <file>icons/angle_supplementary.png</file>
<file>icons/arc.png</file>
<file>icons/arc_base_32x32.png</file>
<file>icons/arc_3pt_32x32.png</file>
#include <SketchPlugin_Line.h>
#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_AttributeInteger.h>
+
#include <GeomDataAPI_Point2D.h>
#include <GeomAPI_Dir2d.h>
data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId());
data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefAttr::typeId());
data()->addAttribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT(), GeomDataAPI_Point2D::typeId());
+
+ data()->addAttribute(SketchPlugin_ConstraintAngle::TYPE_ID(), ModelAPI_AttributeInteger::typeId());
}
void SketchPlugin_ConstraintAngle::colorConfigInfo(std::string& theSection, std::string& theName,
return MY_KIND;
}
+ /// attribute name of operation type
+ inline static const std::string& TYPE_ID()
+ {
+ static const std::string MY_TYPE_ID("angle_type");
+ return MY_TYPE_ID;
+ }
+
/// \brief Creates a new part document if needed
SKETCHPLUGIN_EXPORT virtual void execute();
<sketch-2dpoint_flyout_selector id="ConstraintFlyoutValuePnt" default="computed" internal="1" obligatory="0"/>
<doublevalue_editor label="Value" tooltip="Angle" id="ConstraintValue" default="computed" min="0" max="180" />
<validator id="PartSet_AngleSelection"/>
+ <module_choice id="angle_type"
+ widget_type="radiobuttons"
+ buttons_dir="horizontal"
+ label="Operation type"
+ tooltip="Type of angle"
+ string_list="Direct Supplementary Backward"
+ icons_list=":icons/angle_direct.png :icons/angle_supplementary.png :icons/angle_backward.png"
+ default="0"
+ />
+
</feature>
<!-- SketchConstraintParallel -->
#include <ModelAPI_AttributeRefAttr.h>
#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_AttributeInteger.h>
#include <TopExp.hxx>
#include <BRep_Tool.hxx>
return; // can not create a good presentation
}
+ std::shared_ptr<ModelAPI_AttributeInteger> aTypeAttr = std::dynamic_pointer_cast<
+ ModelAPI_AttributeInteger>(aData->attribute(SketchPlugin_ConstraintAngle::TYPE_ID()));
+ AngleType anAngleType = (AngleType)(aTypeAttr->value());
+
// Flyout point
std::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr =
std::dynamic_pointer_cast<GeomDataAPI_Point2D>
TopoDS_Edge aEdge1 = TopoDS::Edge(aTEdge1);
TopoDS_Edge aEdge2 = TopoDS::Edge(aTEdge2);
- SetMeasuredGeometry(aEdge1, aEdge2);
+
+ switch (anAngleType) {
+ case ANGLE_DIRECT: {
+ SetMeasuredGeometry(aEdge1, aEdge2);
+ }
+ break;
+ case ANGLE_SUPPLEMENTARY: {
+ SetMeasuredGeometry(aEdge1, aEdge2);
+ }
+ break;
+ case ANGLE_BACKWARD: {
+ SetMeasuredGeometry(aEdge2, aEdge1);
+ }
+ break;
+ default:
+ break;
+ }
+
const gp_Pnt& aCenter = CenterPoint();
const gp_Pnt& aFirst = FirstPoint();
*/
class SketcherPrs_Angle : public AIS_AngleDimension
{
+public:
+ /// Type of angle
+ enum AngleType{
+ ANGLE_DIRECT, ///< Angle from the first line to the second line
+ ANGLE_SUPPLEMENTARY, ///< Additional angle to the angle from first to second line
+ ANGLE_BACKWARD ///< Angle from the second line to the first line
+ };
+
public:
/// Constructor
/// \param theConstraint a constraint feature
if (anActiveWidget) {
ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast<ModuleBase_WidgetValidated*>
(anActiveWidget);
- aWidgetValidated->clearValidatedCash();
+ if (aWidgetValidated)
+ aWidgetValidated->clearValidatedCash();
}
}