#include <SketchPlugin_ConstraintParallel.h>
#include <SketchPlugin_ConstraintPerpendicular.h>
#include <SketchPlugin_ConstraintCoincidence.h>
+#include <SketchPlugin_ConstraintRigid.h>
#include <GeomAPI_Pnt2d.h>
|| theId == SketchPlugin_ConstraintRadius::ID()
|| theId == SketchPlugin_ConstraintParallel::ID()
|| theId == SketchPlugin_ConstraintPerpendicular::ID()
- || theId == SketchPlugin_ConstraintCoincidence::ID();
+ || theId == SketchPlugin_ConstraintCoincidence::ID()
+ || theId == SketchPlugin_ConstraintRigid::ID();
}
bool PartSet_OperationFeatureCreate::canBeCommitted() const
#include <SketchPlugin_ConstraintDistance.h>
#include <SketchPlugin_ConstraintLength.h>
#include <SketchPlugin_ConstraintRadius.h>
+#include <SketchPlugin_ConstraintRigid.h>
#include <SketchPlugin_Constraint.h>
#include <ModuleBase_ViewerPrs.h>
{
return theKind == SketchPlugin_ConstraintDistance::ID()
|| theKind == SketchPlugin_ConstraintLength::ID()
- || theKind == SketchPlugin_ConstraintRadius::ID();
+ || theKind == SketchPlugin_ConstraintRadius::ID()
+ || theKind == SketchPlugin_ConstraintRigid::ID();
}
SketchPlugin_ConstraintParallel.h
SketchPlugin_ConstraintPerpendicular.h
SketchPlugin_ConstraintRadius.h
+ SketchPlugin_ConstraintRigid.h
SketchPlugin_Validators.h
SketchPlugin_ResultValidators.h
)
SketchPlugin_ConstraintParallel.cpp
SketchPlugin_ConstraintPerpendicular.cpp
SketchPlugin_ConstraintRadius.cpp
+ SketchPlugin_ConstraintRigid.cpp
SketchPlugin_Validators.cpp
SketchPlugin_ResultValidators.cpp
)
* \ingroup DataModel
* \brief Feature for creation of a new constraint which defines equivalence of two points
*
- * These constraint has two attributes:
+ * This constraint has two attributes:
* SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B()
*/
class SketchPlugin_ConstraintCoincidence : public SketchPlugin_ConstraintBase
* \brief Feature for creation of a new constraint which defines a distance
* between a point and another feature (point, line, plane or face)
*
- * These constraint has three attributes:
+ * This constraint has three attributes:
* SketchPlugin_Constraint::VALUE(), SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B()
*/
class SketchPlugin_ConstraintDistance : public SketchPlugin_ConstraintBase
* \ingroup DataModel
* \brief Feature for creation of a new constraint which defines a length of a line segment
*
- * These constraint has two attributes:
+ * This constraint has two attributes:
* SketchPlugin_Constraint::VALUE() (length) and SketchPlugin_Constraint::ENTITY_A() (segment),
* SketchPlugin_Constraint::FLYOUT_VALUE_PNT() (distance of a constraints handle)
*/
* \ingroup DataModel
* \brief Feature for creation of a new constraint parallelism of two lines
*
- * These constraint has two attributes:
+ * This constraint has two attributes:
* SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B()
*/
class SketchPlugin_ConstraintParallel : public SketchPlugin_ConstraintBase
* \ingroup DataModel
* \brief Feature for creation of a new constraint for perpendicularity of two lines
*
- * These constraint has two attributes:
+ * This constraint has two attributes:
* SketchPlugin_Constraint::ENTITY_A() and SketchPlugin_Constraint::ENTITY_B()
*/
class SketchPlugin_ConstraintPerpendicular : public SketchPlugin_ConstraintBase
* \brief Feature for creation of a new constraint which defines
* a radius of a circle or an arc of circle
*
- * These constraint has two attributes:
+ * This constraint has two attributes:
* SketchPlugin_Constraint::VALUE() (radius), SketchPlugin_Constraint::ENTITY_A() (a circle)
*/
class SketchPlugin_ConstraintRadius : public SketchPlugin_ConstraintBase
--- /dev/null
+// File: SketchPlugin_ConstraintRigid.cpp
+// Created: 13 Oct 2014
+// Author: Artem ZHIDKOV
+
+#include "SketchPlugin_ConstraintRigid.h"
+
+SketchPlugin_ConstraintRigid::SketchPlugin_ConstraintRigid()
+{
+}
+
+void SketchPlugin_ConstraintRigid::initAttributes()
+{
+ data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::type());
+}
+
+void SketchPlugin_ConstraintRigid::execute()
+{
+}
--- /dev/null
+// File: SketchPlugin_ConstraintRigid.h
+// Created: 13 Oct 2014
+// Author: Artem ZHIDKOV
+
+#ifndef SketchPlugin_ConstraintRigid_H_
+#define SketchPlugin_ConstraintRigid_H_
+
+#include "SketchPlugin.h"
+#include "SketchPlugin_ConstraintBase.h"
+#include <SketchPlugin_Sketch.h>
+#include <list>
+
+/** \class SketchPlugin_ConstraintRigid
+ * \ingroup DataModel
+ * \brief Feature for creation of a new constraint which defines immovable object
+ *
+ * This constraint has one attribute:
+ * SketchPlugin_Constraint::ENTITY_A() (any object, i.e. point, line, circle, arc)
+ */
+class SketchPlugin_ConstraintRigid : public SketchPlugin_ConstraintBase
+{
+ public:
+ /// Length constraint kind
+ inline static const std::string& ID()
+ {
+ static const std::string MY_CONSTRAINT_RIGID_ID("SketchConstraintRigid");
+ return MY_CONSTRAINT_RIGID_ID;
+ }
+ /// \brief Returns the kind of a feature
+ SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
+ {
+ static std::string MY_KIND = SketchPlugin_ConstraintRigid::ID();
+ return MY_KIND;
+ }
+
+ /// \brief Creates a new part document if needed
+ SKETCHPLUGIN_EXPORT virtual void execute();
+
+ /// \brief Request for initialization of data model of the feature: adding all attributes
+ SKETCHPLUGIN_EXPORT virtual void initAttributes();
+
+ /// \brief Use plugin manager for features creation
+ SketchPlugin_ConstraintRigid();
+};
+
+#endif
#include "SketchPlugin_ConstraintParallel.h"
#include "SketchPlugin_ConstraintPerpendicular.h"
#include "SketchPlugin_ConstraintRadius.h"
+#include "SketchPlugin_ConstraintRigid.h"
#include "SketchPlugin_Validators.h"
#include "SketchPlugin_ResultValidators.h"
#include <ModelAPI_Session.h>
return FeaturePtr(new SketchPlugin_ConstraintPerpendicular);
} else if (theFeatureID == SketchPlugin_ConstraintRadius::ID()) {
return FeaturePtr(new SketchPlugin_ConstraintRadius);
+ } else if (theFeatureID == SketchPlugin_ConstraintRigid::ID()) {
+ return FeaturePtr(new SketchPlugin_ConstraintRigid);
}
// feature of such kind is not found
return FeaturePtr();
<plugin>
<workbench id="Sketch">
<group id="Basic">
- <feature id="Sketch" nested="SketchPoint SketchLine SketchCircle SketchArc SketchConstraintLength SketchConstraintRadius SketchConstraintDistance SketchConstraintParallel SketchConstraintPerpendicular" title="Sketch" tooltip="Create a new sketch or edit an existing sketch" icon=":icons/sketch.png">
+ <feature id="Sketch" nested="SketchPoint SketchLine SketchCircle SketchArc SketchConstraintLength SketchConstraintRadius SketchConstraintDistance SketchConstraintParallel SketchConstraintPerpendicular SketchConstraintRigid" title="Sketch" tooltip="Create a new sketch or edit an existing sketch" icon=":icons/sketch.png">
<sketch-start-label title="Select a plane on which to create a sketch" tooltip="Select a plane on which to create a sketch"/>
<!--icon=":pictures/x_point.png"-->
</feature>
</feature_selector>
<validator id="PartSet_PerpendicularValidator"/>
</feature>
+
+ <feature id="SketchConstraintRigid" title="Rigid" tooltip="Create constraint defining fixed object" icon="">
+ <feature_selector id="ConstraintEntityA" label="Object" tooltip="Select any object in the viewer">
+ <validator id="SketchPlugin_ResultPoint"/>
+ <validator id="SketchPlugin_ResultLine"/>
+ <validator id="SketchPlugin_ResultArc"/>
+ </feature_selector>
+ </feature>
</group>
</workbench>
</plugin>